<template>
  <div>
    <bar-top></bar-top>
    <div>
      <h3>page1</h3>
    </div>
    <div>
      <button @click="openAWin">click</button>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ipcRenderer } from "electron";
import { onMounted } from "vue";
import BarTop from "../Component/BarTop.vue";
import { createDialog } from "../common";

onMounted(() => {
  ipcRenderer.invoke("showWindow");
});

window.addEventListener("message", (e) => {
  console.log(e.data);
});
const openAWin = async () => {
  let config = {
    modal: true,
    width: 400,
    webPreferences: { webviewTag: false },
  };
  let dialog = await createDialog("/testSideDiv", JSON.stringify(config));
  dialog.postMessage({ msgName: "hello", value: "msg from your parent" });
};
</script>

<style scoped></style>
